<#assign ctx=springMacroRequestContext.contextPath />
<#include "/macro/publicMacro.ftl">
<#import "/macro/pagination.ftl" as Pagination>
<#import "/macro/FormItem.ftl" as Form>

<@header title="部门编辑">
    <link href="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.min.css" rel="stylesheet">
</@header>

<@body>
<h2 class="module-title">部门编辑</h2>

<div class="alert alert-primary" role="alert">
    <button class="btn btn-info" onclick="javascript: history.back(-1);return false;" >返回</button>
</div>

<form class="form-horizontal" id="imDepartmentForm" action="${ctx}/imDepartment/save" method="post">
    <input type="hidden" name="id" value="${imDepartment.id}"/>
    <@Form.FormItem name="name" label="部门名称">
        <input type="text" class="form-control" name="name" id="name" aria-describedby="部门名称" value="${imDepartment.name}">
    </@Form.FormItem>
    <@Form.FormItem name="code" label="部门编码">
        <input type="text" class="form-control" name="code" id="code" aria-describedby="部门编码" value="${imDepartment.code}">
    </@Form.FormItem>
    <@Form.FormItem name="parentId" label="上级部门id">
        <input type="text" class="form-control" name="parentId" id="parentId" aria-describedby="上级部门id" value="${imDepartment.parentId}">
    </@Form.FormItem>
    <@Form.FormItem name="description" label="">
        <input type="text" class="form-control" name="description" id="description" aria-describedby="" value="${imDepartment.description}">
    </@Form.FormItem>
    <@Form.FormItem name="managerUserId" label="">
        <input type="text" class="form-control" name="managerUserId" id="managerUserId" aria-describedby="" value="${imDepartment.managerUserId}">
    </@Form.FormItem>
    <@Form.FormItem name="enable" label="">
        <input type="text" class="form-control" name="enable" id="enable" aria-describedby="" value="${imDepartment.enable}">
    </@Form.FormItem>
    <@Form.FormItem name="otherManagerUserIds" label="">
        <input type="text" class="form-control" name="otherManagerUserIds" id="otherManagerUserIds" aria-describedby="" value="${imDepartment.otherManagerUserIds}">
    </@Form.FormItem>
    <@Form.FormItem name="tenantCode" label="租户id">
        <input type="text" class="form-control" name="tenantCode" id="tenantCode" aria-describedby="租户id" value="${imDepartment.tenantCode}">
    </@Form.FormItem>
    <@Form.FormItem name="createTime" label="创建时间">
        <div class='input-group date' id='createTime1'>
            <input type="text" class="form-control" name="createTime" id="createTime" aria-describedby="创建时间" value="${(imDepartment.createTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="updateTime" label="更新时间">
        <div class='input-group date' id='updateTime1'>
            <input type="text" class="form-control" name="updateTime" id="updateTime" aria-describedby="更新时间" value="${(imDepartment.updateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <@Form.FormItem name="clientUpdateTime" label="">
        <div class='input-group date' id='clientUpdateTime1'>
            <input type="text" class="form-control" name="clientUpdateTime" id="clientUpdateTime" aria-describedby="" value="${(imDepartment.clientUpdateTime?string('yyyy-MM-dd hh:mm:ss'))!}">
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar"></span>
            </span>
        </div>
    </@Form.FormItem>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary">提交</button>
        </div>
    </div>
</form>
</@body>

<@footer>
    <script src="${ctx}/resource/frame/datetimepicker/jquery.datetimepicker.full.min.js"></script>
    <script src="${ctx}/resource/common/js/jquery.validate.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $('#createTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#updateTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
            $('#clientUpdateTime').datetimepicker({
                format:'Y-m-d H:i:s',
                lang:'zh'});
        });

        $().ready(function() {
            $("#imDepartmentForm").validate({
                rules: {
                    id: {
                        required: true,
                        digits: true
                    },
                    name: "required" ,
                    code: "required" ,
                    parentId: {
                        required: true,
                        digits: true
                    },
                   description: {
                      maxlength: 2,048
                   },
                   managerUserId: {
                      maxlength: 20
                   },
                   enable: "required" ,
                   otherManagerUserIds: {
                      maxlength: 2,048
                   },
                   tenantCode: {
                      maxlength: 4
                   },
                    createTime: {
                        required: true,
                        date: true
                    },
                    updateTime: {
                        required: true,
                        date: true
                    },
                   clientUpdateTime: {
                      maxlength: 26
                   }
                }
            });
        });
    </script>
</@footer>